package com.fjw.mapper;

import com.fjw.pojo.Cv;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CvMapper {

    //新增简历
    @Insert("insert into Cv(title,job_prefer,education_exp,project_exp,internship,price,other_advantage,cvURL,author) values (#{title},#{job_prefer},#{education_exp},#{project_exp},#{internship},#{price},#{other_advantage},#{cvURL},#{author})")
    void add(Cv cv);

    //通过ID查找
    @Select("select * from Cv where id=#{id}")
    Cv findById(Integer id);

    //通过作者查找
    @Select("select * from Cv where author=#{author}")
    List<Cv> findByAuthor(Integer author);

    //获取所有
    @Select("select * from Cv")
    List<Cv> getAll();

    //通过ID更新
    @Update("update Cv set title=#{title},job_prefer=#{job_prefer},education_exp=#{education_exp},project_exp=#{project_exp},internship=#{internship},price=#{price},other_advantage=#{other_advantage},cvURL=#{cvURL} where id=#{id}")
    void updataById(Cv cv);
}
